package com.test.model;

import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;
import java.util.Set;

/**
 * 
 * @author zxw
 * create 2016年3月7日 上午9:33:06
 */
@Entity
@Table(name="rcc_e_buildMeter")
public class BuildMeter extends EquModel{
	private Integer uniqueId;
    private String serialNo;
    private Integer caliber;
    private Model model;
    private Collector collector;
    private Integer port;
    private Integer index;
    private Date installDate;
    private Date createDate;
    private Unit unit;
    private Build build;
    private StationBranch stationBranch;
    private String memo;
    private String detailPosition;
    private Boolean isCalc;
    private BigDecimal heatingArea;
	private NetEqu netEqu;
	private BigDecimal constructionArea;
	private BigDecimal stationDistance;
	private String equState;
	private Dictionary equProblem;
	//2017/4/12 全网平衡添加
	private BigDecimal temperatureWeight;
	private Boolean isCtrl;
	private String heatingType;
	private BigDecimal designFlow;
	private Boolean isAnchorPoint;

	private Boolean isConfirm;

	private Set<BuildMeterCurrentData> buildMeterCurrentData;
//    private Set<BuildMeterCurrentAlarm> buildMeterCurrentAlarm;
//    private Set<BuildMeterCurrentFault> buildMeterCurrentFault;
//	private Set<BuildMeterHistoricalAlarm> buildMeterHistoricalAlarm;
//	private Set<BuildMeterHistoricalFault> buildMeterHistoricalFault;

	@Id
    @GeneratedValue
    @Column(name = "uniqueId", unique = true, nullable = false)
	public Integer getUniqueId() {
		return uniqueId;
	}
	public void setUniqueId(Integer uniqueId) {
		this.uniqueId = uniqueId;
	}
	 @Column(name = "serialNo")
	public String getSerialNo() {
		return serialNo;
	}
	public void setSerialNo(String serialNo) {
		this.serialNo = serialNo;
	}
	 @Column(name = "caliber")
	public Integer getCaliber() {
		return caliber;
	}
	public void setCaliber(Integer caliber) {
		this.caliber = caliber;
	}
	 @ManyToOne(fetch = FetchType.LAZY)
	 @JoinColumn(name = "modelId")
	public Model getModel() {
		return model;
	}
	public void setModel(Model model) {
		this.model = model;
	}
	 @ManyToOne(fetch = FetchType.LAZY)
	 @JoinColumn(name = "collectorId")
	public Collector getCollector() {
		return collector;
	}
	public void setCollector(Collector collector) {
		this.collector = collector;
	}
	 @Column(name = "`port`")
	public Integer getPort() {
		return port;
	}
	public void setPort(Integer port) {
		this.port = port;
	}
	 @Column(name = "`index`")
	public Integer getIndex() {
		return index;
	}
	public void setIndex(Integer index) {
		this.index = index;
	}
	@Column(name = "installDate")
	public Date getInstallDate() {
		return installDate;
	}
	public void setInstallDate(Date installDate) {
		this.installDate = installDate;
	}
	 @Column(name = "createDate")
	public Date getCreateDate() {
		return createDate;
	}
	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}
	 @ManyToOne(fetch = FetchType.LAZY)
	 @JoinColumn(name = "unitId")
	public Unit getUnit() {
		return unit;
	}
	public void setUnit(Unit unit) {
		this.unit = unit;
	}
	 @ManyToOne(fetch = FetchType.LAZY)
	 @JoinColumn(name = "stationBranchId")
	public StationBranch getStationBranch() {
		return stationBranch;
	}
	public void setStationBranch(StationBranch stationBranch) {
		this.stationBranch = stationBranch;
	}
	@Column(name = "memo")
	public String getMemo() {
		return memo;
	}
	public void setMemo(String memo) {
		this.memo = memo;
	}
	 @Column(name = "detailPosition")
	public String getDetailPosition() {
		return detailPosition;
	}
	public void setDetailPosition(String detailPosition) {
		this.detailPosition = detailPosition;
	}
	 @Column(name = "isCalc")
	public Boolean getIsCalc() {
		return isCalc;
	}
	public void setIsCalc(Boolean isCalc) {
		this.isCalc = isCalc;
	}
	@Column(name = "heatingArea")
    public BigDecimal getHeatingArea() {
		return heatingArea;
	}
	public void setHeatingArea(BigDecimal heatingArea) {
		this.heatingArea = heatingArea;
	}
//	@OneToMany(mappedBy = "buildMeter")
//	public Set<BuildMeterCurrentAlarm> getBuildMeterCurrentAlarm() {
//		return buildMeterCurrentAlarm;
//	}
//	public void setBuildMeterCurrentAlarm(Set<BuildMeterCurrentAlarm> buildMeterCurrentAlarm) {
//		this.buildMeterCurrentAlarm = buildMeterCurrentAlarm;
//	}
//
//	@OneToMany(mappedBy = "buildMeter")
//	public Set<BuildMeterCurrentFault> getBuildMeterCurrentFault() {
//		return buildMeterCurrentFault;
//	}
//	public void setBuildMeterCurrentFault(Set<BuildMeterCurrentFault> buildMeterCurrentFault) {
//		this.buildMeterCurrentFault = buildMeterCurrentFault;
//	}
//
//	@OneToMany(mappedBy = "buildMeter")
//	public Set<BuildMeterHistoricalAlarm> getBuildMeterHistoricalAlarm() {
//		return buildMeterHistoricalAlarm;
//	}
//
//	public void setBuildMeterHistoricalAlarm(Set<BuildMeterHistoricalAlarm> buildMeterHistoricalAlarm) {
//		this.buildMeterHistoricalAlarm = buildMeterHistoricalAlarm;
//	}
//
//	@OneToMany(mappedBy = "buildMeter")
//	public Set<BuildMeterHistoricalFault> getBuildMeterHistoricalFault() {
//		return buildMeterHistoricalFault;
//	}
//
//	public void setBuildMeterHistoricalFault(Set<BuildMeterHistoricalFault> buildMeterHistoricalFault) {
//		this.buildMeterHistoricalFault = buildMeterHistoricalFault;
//	}
//
	@OneToMany(mappedBy = "buildMeter")
	public Set<BuildMeterCurrentData> getBuildMeterCurrentData() {
		return buildMeterCurrentData;
	}
	public void setBuildMeterCurrentData(Set<BuildMeterCurrentData> buildMeterCurrentData) {
		this.buildMeterCurrentData = buildMeterCurrentData;
	}
	
	 @ManyToOne(fetch = FetchType.LAZY)
	 @JoinColumn(name = "buildId")
	public Build getBuild() {
		return build;
	}
	public void setBuild(Build build) {
		this.build = build;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "netEquId")
	public NetEqu getNetEqu() {
		return netEqu;
	}

	public void setNetEqu(NetEqu netEqu) {
		this.netEqu = netEqu;
	}

	@Column(name = "constructionArea")
	public BigDecimal getConstructionArea() {
		return constructionArea;
	}

	public void setConstructionArea(BigDecimal constructionArea) {
		this.constructionArea = constructionArea;
	}

	@Column(name = "stationDistance")
	public BigDecimal getStationDistance() {
		return stationDistance;
	}

	public void setStationDistance(BigDecimal stationDistance) {
		this.stationDistance = stationDistance;
	}
	@Column(name = "equState")
	public String getEquState() {
		return equState==null?"可用":equState;
	}

	public void setEquState(String equState) {
		this.equState = equState;
	}
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "equProblem")
	@NotFound(action = NotFoundAction.IGNORE)
	public Dictionary getEquProblem() {
		return equProblem;
	}

	public void setEquProblem(Dictionary equProblem) {
		this.equProblem = equProblem;
	}
	@Column(name = "temperatureWeight")
	public BigDecimal getTemperatureWeight() {
		return temperatureWeight;
	}
	public void setTemperatureWeight(BigDecimal temperatureWeight) {
		this.temperatureWeight = temperatureWeight;
	}
	
	@Column(name = "isCtrl")
	public Boolean getIsCtrl() {
		return isCtrl;
	}
	public void setIsCtrl(Boolean isCtrl) {
		this.isCtrl = isCtrl;
	}
	@Column(name = "heatingType")
	public String getHeatingType() {
		return heatingType;
	}
	public void setHeatingType(String heatingType) {
		this.heatingType = heatingType;
	}
	@Column(name = "designFlow")
	public BigDecimal getDesignFlow() {
		return designFlow;
	}
	public void setDesignFlow(BigDecimal designFlow) {
		this.designFlow = designFlow;
	}
	@Column(name = "isAnchorPoint")
	public Boolean getIsAnchorPoint() {
		return isAnchorPoint;
	}
	public void setIsAnchorPoint(Boolean isAnchorPoint) {
		this.isAnchorPoint = isAnchorPoint;
	}

	@Column(name = "isConfirm")
	public Boolean getIsConfirm() {
		return isConfirm;
	}

	public void setIsConfirm(Boolean isConfirm) {
		this.isConfirm = isConfirm;
	}
}
